using System;
using NUnit.Framework;

namespace Org.JSON.Test.Deserialization
{
	[TestFixture]
	public class Array
	{
		[Test]
		public void Instance()
		{
			Assert.IsInstanceOf<Org.JSON.Array>(Org.JSON.Value.From("[]"));
		}

		[Test]
		public void Empty()
		{
			Assert.AreEqual(0, (Org.JSON.Value.From("[]") as Org.JSON.Array).Length);
		}

		[Test]
		public void OneItemLength()
		{
			Assert.AreEqual(1, (Org.JSON.Value.From("[null]") as Org.JSON.Array).Length);
		}

		[Test]
		public void ManyItemLength()
		{
			Assert.AreEqual(3, (Org.JSON.Value.From("[null,null,null]") as Org.JSON.Array).Length);
		}

		[Test]
		public void InnerValues()
		{
			var array = Org.JSON.Value.From("[[]]") as Org.JSON.Array;
			Assert.IsInstanceOf<Org.JSON.Array>(array[0]);
		}
	}
}

